package com.trainoo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.UUID;

/**
 * @Auther: zt
 * @Date: 2020/4/8 12:10
 * @Description:
 */
@Controller
public class TestController {

    @Autowired
    private RedisTemplate<String, String> redisTemplate;
    private static Logger LOG = LoggerFactory.getLogger(TestController.class);

    @ResponseBody
    @RequestMapping("/test")
    public String testRedis(){
        String s  = UUID.randomUUID().toString();

        redisTemplate.opsForValue().set("testRedis:" + s, "123456767989qazwsxedcrfvtgbyhn_{:>+}");

        LOG.info(Thread.currentThread().getName());

        return "200";
    }
}
